import 'package:enterprise_v8/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v8/app/data/entities/auth/app_update_entity.dart';

AppUpdateEntity $AppUpdateEntityFromJson(Map<String, dynamic> json) {
  final AppUpdateEntity appUpdateEntity = AppUpdateEntity();
  final String? upgradeDescription = jsonConvert.convert<String>(json['upgradeDescription']);
  if (upgradeDescription != null) {
    appUpdateEntity.upgradeDescription = upgradeDescription;
  }
  final int? isForcedUpgrade = jsonConvert.convert<int>(json['isForcedUpgrade']);
  if (isForcedUpgrade != null) {
    appUpdateEntity.isForcedUpgrade = isForcedUpgrade;
  }
  final String? downloadAddress = jsonConvert.convert<String>(json['downloadAddress']);
  if (downloadAddress != null) {
    appUpdateEntity.downloadAddress = downloadAddress;
  }
  final String? version = jsonConvert.convert<String>(json['version']);
  if (version != null) {
    appUpdateEntity.version = version;
  }
  return appUpdateEntity;
}

Map<String, dynamic> $AppUpdateEntityToJson(AppUpdateEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['upgradeDescription'] = entity.upgradeDescription;
  data['isForcedUpgrade'] = entity.isForcedUpgrade;
  data['downloadAddress'] = entity.downloadAddress;
  data['version'] = entity.version;
  return data;
}

extension AppUpdateEntityExtension on AppUpdateEntity {
  AppUpdateEntity copyWith({
    String? upgradeDescription,
    int? isForcedUpgrade,
    String? downloadAddress,
    String? version,
  }) {
    return AppUpdateEntity()
      ..upgradeDescription = upgradeDescription ?? this.upgradeDescription
      ..isForcedUpgrade = isForcedUpgrade ?? this.isForcedUpgrade
      ..downloadAddress = downloadAddress ?? this.downloadAddress
      ..version = version ?? this.version;
  }
}